<!DOCTYPE html>
<html>
#{include file="header.html"}#
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox-content">
        <form class="form-horizontal" method="post" action="#">
            <div class="form-group">
                <label class="col-sm-2 control-label">姓名</label>
                <div class="col-sm-8">
                    <input name="name" class="form-control" type="text" placeholder="请输姓名" required/>
                    <span class="help-block m-b-none"></span></div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">姓别</label>
                <div class="col-sm-8">
                    <div class="radio i-checks">
                        <input type="radio" value="1" name="gender" checked>
                        男
                        <input type="radio" value="0" name="gender">
                        女
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">手机</label>
                <div class="col-sm-8">
                    <input name="mobile" class="form-control" type="text" placeholder="请输手机" required/>
                    <span class="help-block m-b-none"></span></div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">职位</label>
                <div class="col-sm-8">
                    <input name="postion" class="form-control" type="text" placeholder="请输职位"/>
                    <span class="help-block m-b-none"></span></div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">电话</label>
                <div class="col-sm-8">
                    <input name="tel" class="form-control" type="text" placeholder="请输电话"/>
                    <span class="help-block m-b-none"></span></div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">QQ</label>
                <div class="col-sm-8">
                    <input name="qicq" class="form-control" type="text" placeholder="QQ"/>
                    <span class="help-block m-b-none"></span></div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">邮箱</label>
                <div class="col-sm-8">
                    <input name="email" class="form-control" type="text" placeholder="请输邮箱"/>
                    <span class="help-block m-b-none"></span></div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">通信地址</label>
                <div class="col-sm-8">
                    <input name="address" class="form-control" type="text" placeholder="请输通信地址"/>
                    <span class="help-block m-b-none"></span></div>
            </div>
            <div class="form-group text-left">
                <label class="col-sm-2 control-label">客户名称</label>
                <div class="col-sm-8">
                    <select data-placeholder="请选客户名称..." name="customer_id" class="chosen-select" style="width: 200px;"
                            tabindex="2">
                        <option value="">请选客户名称</option>
                        #{foreach from=$customer key=k item=v}#
                        <option value="#{$v.customer_id}#" hassubinfo="true">#{$v.name}#</option>
                        #{/foreach}#
                    </select>
                </div>
            </div>
            #{$field_ext}#
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-8">
                    <button class="btn btn-w-m btn-info save-form" type="button">保存数据</button>
                </div>
            </div>
        </form>
    </div>
</div>
<!-- 自定义js -->
<script src="#{$smarty.const.APP}#/View/template/js/content.js?v=1.0.0"></script>
<script>
    $(document).ready(function () {
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green',
        });
        $('.chosen-select').chosen({search_contains: true});
        $(".chosen-select").val("#{$customer_id}#").trigger("chosen:updated");

        $("body").on("click", ".save-form", function () {
            FormData = $("form").serialize();
            $.ajax({
                type: "POST",
                url: "#{$smarty.const.ACT}#/crm/CstLinkman/cst_linkman_add/",
                data: FormData,
                dataType: "json",
                success: function (data) {
                    if (data.rtnstatus == 'success') {
                        layer.msg('操作成功', {icon: 1});
                    }
                },
                complete: function () {
                    setTimeout(function () {
                        //关闭窗口
                        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                        parent.layer.close(index);
                    }, 800);

                },
            });
        });
    });
</script>
</body>
</html>